<%@ page language="java" contentType="text/html; charset=UTF-8"%>
<!DOCTYPE html>
<html>
<head>
<title>角色主页</title>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta name="renderer" content="webkit">
<%@ include file="/WEB-INF/common.jsp"%>

<link href="${path }/resources/css/plugins/bootstrap-table/bootstrap-table.min.css" rel="stylesheet">
<link href="${path }/resources/css/animate.css" rel="stylesheet">
<link href="${path }/resources/css/style.css?v=4.1.0" rel="stylesheet">

<!--dataTables css样式-->
<link rel="stylesheet" type="text/css"
	href="${path }/resources/css/jquery.dataTables.min.css">
<!--DataTables button扩展-->
<link rel="stylesheet" type="text/css"
	href="${path }/resources/css/buttons.dataTables.min.css">
<link rel="stylesheet" type="text/css"
	href="${path }/resources/css/form.css">


</head>
<body class="gray-bg" style="">
<jsp:include page="/WEB-INF/loginCheck.jsp" />
	<div>
		<h1 style="margin-left:20px">编辑账号信息</h1>
	</div>
	<hr>
	<!--添加的表单  -->
	<div id="" barclass="panel-body" style="margin-top: 30px">
		<form id="defaultForm" action="${path }/Enterprise/editEmployee.htm" method="post" data-parsley-validate
										class="form-horizontal form-label-left"  enctype="multipart/form-data">
			<input type="hidden" name="id" value="${userBasicInfo.id }">
			<input type="hidden" name="type" value="2">
			<div class="form-group">
				<label class="control-label col-md-3 col-sm-3 col-xs-12"
					for="last-name">员工姓名：<span class="required">*</span>
				</label>
				<div class="col-md-6 col-sm-6 col-xs-12">
					<input  value="${userBasicInfo.name}" name="name" class="form-control col-md-7 col-xs-12">
				</div>
			</div>
			<div class="form-group">
				
				<label class="control-label col-md-3 col-sm-3 col-xs-12"
					for="first-name">性别<span class="required">*</span>
				</label>
				<label style="font-size:20px"><input value="男" name="gender" type="radio" style="margin-left:80px;">男</label>
				<label style="font-size:20px"><input value="女" name="gender" type="radio" style="margin-left:200px;">女</label>
				<input type="hidden" id="genderHidden" value="${userBasicInfo.gender}">
			</div>
			<div class="form-group">
				<label class="control-label col-md-3 col-sm-3 col-xs-12"
					for="last-name">年龄<span class="required">*</span>
				</label>
				<div class="col-md-6 col-sm-6 col-xs-12">
					<input  value="${userBasicInfo.age}" name="age" type="number" class="form-control col-md-7 col-xs-12">
				</div>
			</div>
<!-- 			<div class="form-group">
				<label class="control-label col-md-3 col-sm-3 col-xs-12"
					for="last-name">账号<span class="required">*</span>
				</label>
				<div class="col-md-6 col-sm-6 col-xs-12">
					<input  value="" name="login_id" required="required" class="form-control col-md-7 col-xs-12" required="required">
				</div>
			</div> -->
			<div class="form-group">
				<label class="control-label col-md-3 col-sm-3 col-xs-12"
					for="last-name">电话<span class="required">*</span>
				</label>
				<div class="col-md-6 col-sm-6 col-xs-12">
					<input  type="number" value="${userBasicInfo.phoneNumber}" name="phone_number" class="form-control col-md-7 col-xs-12">
				</div>
			</div>
			<div class="form-group">
				<label class="control-label col-md-3 col-sm-3 col-xs-12"
					for="last-name">身份证号<span class="required">*</span>
				</label>
				<div class="col-md-6 col-sm-6 col-xs-12">
					<input type="number" value="${userBasicInfo.identificationCard}" name="identification_card" class="form-control col-md-7 col-xs-12">
				</div>
			</div>
			<div class="form-group">
				<label class="control-label col-md-3 col-sm-3 col-xs-12"
					for="last-name">身份<span class="required">*</span>
				</label>
				<div class="col-md-6 col-sm-6 col-xs-12">
					<select id="personIdentity" class="selectpicker form-control" data-live-search="true" name="personIdentity">
						<option value="维保企业">维保企业</option>
					</select>
					<input type="hidden" id="personIdentityHidden" value="${userBasicInfo.personIdentity}">
				</div>
			</div>
			<div class="form-group">
				<label class="control-label col-md-3 col-sm-3 col-xs-12"
					for="last-name">所属维保企业<span class="required">*</span>
				</label>
				<div class="col-md-6 col-sm-6 col-xs-12">
					<select id="enterpriseId" class="selectpicker form-control" data-live-search="true" name="enterprise_id">
					    <c:forEach items="${enterList}" var="enterList" >
							<option value="${enterList.id}"><c:out value="${enterList.name}"/></option>
						</c:forEach>
					</select>
					<input type="hidden" id="enterpriseIdHidden" value="${userBasicInfo.enterpriseId}">
				</div>
			</div>
			<div class="form-group">
				<label class="control-label col-md-3 col-sm-3 col-xs-12"
					for="last-name">角色<span class="required">*</span>
				</label>
				<div class="col-md-6 col-sm-6 col-xs-12">
				<!-- readonly="true" disabled="disabled" onfocus="this.defaultIndex=this.selectedIndex;" onchange="this.selectedIndex=this.defaultIndex;"-->
					<select id="roleId" class="selectpicker form-control" data-live-search="true" name="roleId" disabled="disabled">
						<option value="3">维保工程师</option>
		                <option value="2">项目负责人</option>
		                <option value="1">企业管理员</option>
					</select>
					<input type="hidden" id="roleHidden" value="${userBasicInfo.roleId}">
				</div>
			</div>
						<div class="form-group">
				<label class="control-label col-md-3 col-sm-3 col-xs-12"
					for="last-name">专业技术等级<span class="required">*</span>
				</label>
				<div class="col-md-6 col-sm-6 col-xs-12">
					<select id="technical_level" class="selectpicker form-control" data-live-search="true" name="technical_level" >
						<option value="一级">一级</option>
		                <option value="二级">二级</option>
		                <option value="三级">三级</option>
					</select>
					<input type="hidden" id="levelHidden" value="${userBasicInfo.technicalLevel}">
				</div>
			</div>
			<div class="form-group">
				<label class="control-label col-md-3 col-sm-3 col-xs-12"
					for="last-name">职务<span class="required">*</span>
				</label>
				<div class="col-md-6 col-sm-6 col-xs-12">
					<input  value="${userBasicInfo.position}" name="position" rclass="form-control col-md-7 col-xs-12">
				</div>
			</div>
			<div class="form-group">
				
				<label class="control-label col-md-3 col-sm-3 col-xs-12"
					for="first-name">状态<span class="required">*</span>
				</label>
				<label style="font-size:20px"><input value="开启" name="status" type="radio"  style="margin-left:80px;">开启</label>
				<label style="font-size:20px"><input value="停止" name="status" type="radio" style="margin-left:200px;">停止</label>
				<input type="hidden" id="statusHidden" value="${userBasicInfo.status}">
			</div>
<%-- 			<!-- 上传图片 -->
			<div class="form-group">
				<label for="middle-name"
					class="control-label col-md-3 col-sm-3 col-xs-12">资质证书图片</label>
				<div class="col-md-6 col-sm-6 col-xs-12">
					 <input type="file" name="file" accept="image/gif,image/jpeg,image/jpg,image/png" value="${content.certificatePicture}">
							<span></span>
				</div>
			</div> --%>
			<div class="form-group">
				<div class="col-md-6 col-sm-6 col-xs-12 col-md-offset-3" >
					<button type="submit" onclick="disable()" class="btn btn-success">提交</button>
					<a href="${path }/Enterprise/getPersonList.htm" class="btn btn-primary" style="margin-left:550px;">返回</a>
				</div>
			</div>

		</form>

	</div>
	
  	<!--表格  -->
 	<div class="col-md-12 col-sm-12 col-xs-12" style="margin-top: 30px">
	

	</div>
 

	
	<!-- Peity-->
	<script src="${path }/resources/js/plugins/peity/jquery.peity.min.js"></script>
	
	<!-- Bootstrap table-->
	<script src="${path }/resources/js/plugins/bootstrap-table/bootstrap-table.min.js"></script>
	<script src="${path }/resources/js/plugins/bootstrap-table/locale/bootstrap-table-zh-CN.min.js"></script>

	<!-- 自定义js-->
	<script src="${path }/resources/js/content.js?v=1.0.0"></script>
	
	<!-- jQuery Validation plugin javascript-->
    <script src="${path }/resources/js/plugins/validate/jquery.validate.min.js"></script>
    <script src="${path }/resources/js/plugins/validate/messages_zh.min.js"></script>
   
   	<!-- jQuery form  -->
    <script src="${path }/resources/js/jquery.form.min.js"></script>
    
    <!-- layer javascript -->
    <script src="${path }/resources/js/plugins/layer/layer.min.js"></script>
    <!-- 表单验证 -->
    <script src="${path }/resources/js/jquery.min.js"></script>
    <script src="${path }/resources/js/jquery.validate.min.js"></script>
    
<script type="text/javascript">
function disable(){
	$("#roleId").removeAttr("disabled");
}
	</script> 
	<script type="text/javascript">
	<!-- 设置下拉框的默认值 -->	
	window.onload=function(){
		var gender = $("#genderHidden").val();
		$("input[name=gender][value=" + gender + "]").attr("checked", true); //设置当前性别选中项
	
		var personIdentity = $("#personIdentityHidden").val();//设置当前身份选中项
		$("#personIdentity").val(personIdentity);
		
		var enterpriseIdHidden = $("#enterpriseIdHidden").val();//设置当前所属维保企业选中项
		$("#enterpriseId").val(enterpriseIdHidden);
		
		var roleId = $("#roleHidden").val();//设置当前角色选中项
		$("#roleId").val(roleId);
		
		
		var level = $("#levelHidden").val();//设置当前角色选中项
		$("#technical_level").val(level);
		
		var status = $("#statusHidden").val();
		$("input[name=status][value=" + status + "]").attr("checked", true); //设置当前状态选中项
		
		}
	</script>
<script type="text/javascript">
$("#defaultForm").validate({
	onsubmit:true,// 是否在提交是验证
	onfocusout:false,// 是否在获取焦点时验证
	onkeyupd :false,// 是否在敲击键盘时验证
	
	rules:{
		name:{
			required:true
		},
		gender:{
			required:true
		},
		age:{
			required:true,
			digits:true,//必须输入整数
			rangelength:[1,3],//输入长度
		},
		phone_number:{
			required:true,
		 	digits:true,
		 	rangelength:[11,11],//输入长度
		},
		identification_card:{
			required:true,
			digits:true
		},
		password:{
			required:true
		},
		personIdentity:{
			required:true
		},
		position:{
			required:true
		},
		status:{
			required:true
		},
	},
	messages:{
		name:{
			required:"请输入用户名"
		},
		gender:{
			required:"请选择性别",
			digits:"年龄长度不超过三位"
		},
		age:{
			required:"请输入年龄",
			digits:"年龄必须是整数",
			rangelength:"年龄应是1至3位"
		},
		phone_number:{
			required:"请输入电话",
			digits:"年龄必须是整数",
			rangelength:"电话号码必须是11位"
		},
		identification_card:{
			required:"请输入身份证号",
			digits:"身份证号必须是整数"
		},
		password:{
			required:"请输入密码"
		},
		personIdentity:{
			required:"请选择身份"
		},
		position:{
			required:"请输入职务"
		},		
		status:{
			required:"请选择状态"
		},
	},
	submitHandler:function(form){//通过之后回调
		alert("编辑成功！");
		form.submit();
	}
	
});
</script>
</body>
</html>